package com.wxb.lottery.controller;

/**
 * @desc 摇签模块
 * @date 20250805
 * @author hd
 */

import com.wxb.common.core.web.controller.BaseController;
import com.wxb.common.core.web.domain.AjaxResult;
import com.wxb.lottery.domain.LotterySign;
import com.wxb.lottery.service.LotteryService;
import com.wxb.lottery.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
public class LotteryController extends BaseController {
    @Autowired
    private LotteryService lotteryService;
    /**
     * 获取抽到签的信息
     * @return 签的详情信息
     */
    @GetMapping("/signDrawLots")
    public AjaxResult getAllSignInfoByCon(){
        // 获取当前的随机数
        Integer id = RandomUtil.getRandomNum(100);
        if (id < 1|| id > 100) {
            return AjaxResult.error("命格不清,请重新摇签!");
        }
        LotterySign lotterySign = lotteryService.getSignInfoInfoById(id);
        return AjaxResult.success("抽签成功!",lotterySign);
    }

}
